package org.ccay.demo.tree.service;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.ccay.core.base.BatchVO;
import org.ccay.core.base.PageVO;
import org.ccay.core.base.PagedResult;
import org.ccay.core.exception.ApplicationException;
import org.ccay.demo.tree.TreeVO;

/**
 * 
 * 测试--树Service接口
 * @author chaowangbang
 * @since 2012-9-22
 */
@Path("/tree")
@Produces("application/json")
public interface ITreeService {

	/**
	 * 通过条件查询节点信息	
	 * @param queryTree
	 * @return
	 */
	@GET
	@Path("list")
	List<TreeVO> findTreeListByCondition(@QueryParam("") TreeVO queryTree);
	
	/**
	 * 通过条件查询节点信息	
	 * @param queryTree
	 * @return
	 */
	@GET
	@Path("rootlist")
	List<TreeVO> findTreeListByParentId(@QueryParam("") TreeVO queryTree);
	
	/**
	 * 通过条件查询分页节点信息
	 * @param queryTree
	 * @param pageVO
	 * @return
	 */
	@GET
	@Path("rootlist/{pageSize}/{curPage}")
	PagedResult<TreeVO> findPagedTreeList(@QueryParam("") TreeVO queryTree, @PathParam("") PageVO pageVO);
	
	/**
	   * 单个添加	
	 * @param newTrees
	 * @throws ApplicationException
	 */
	@POST
	@Path("/create")
	void createTree(TreeVO newTrees) throws ApplicationException;
	/**
	 * 批量增加节点信息
	 * @param newTrees
	 * @throws ApplicationException
	 */
	void createTrees(List<TreeVO> newTrees) throws ApplicationException;
	
	/**
	 * 单个删除	
	 * @param existedTrees
	 * @throws ApplicationException
	 */
	@DELETE
	@Path("/delete")
	void deleteTree(@QueryParam("") TreeVO existedTrees) throws ApplicationException;
	
	/**
	 * 批量删除节点信息
	 * @param existedTrees
	 * @throws ApplicationException
	 */
	void deleteTrees(List<TreeVO> existedTrees) throws ApplicationException;
	
	/**
	 * 批量删除节点信息
	 * @param existedTrees
	 * @throws ApplicationException
	 */
	void deleteTreesLazyLoad(List<TreeVO> existedTrees) throws ApplicationException;
	
	/**
	 * 单个更新	
	 * @param existedTrees
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/edit")
	void updateTree(TreeVO existedTrees) throws ApplicationException;
	/**
	 * 批量修改节点信息
	 * @param existedTrees
	 * @throws ApplicationException
	 */
	void updateTrees(List<TreeVO> existedTrees) throws ApplicationException;
	
	/**
	 * 批量操作节点信息
	 * @param batchItems
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/batch/{isLazyLoad}")
	void batchOperation(BatchVO<TreeVO> batchItems, @PathParam("isLazyLoad") Boolean isLazyLoad) throws ApplicationException;
}
